package com.yuandian.api.business_monitor.vo;

import lombok.Data;

/**
 * 访问量分布详情VO
 *
 * @author zhoutian
 * @date 2020/9/30 11:01
 */
@Data
public class VisitDistribteDetailVO {

    public VisitDistribteDetailVO() {
        this.visitCount = 0;
        this.avgVisitCount = 0;
        this.failVisitCount = 0;
        this.avgFailVisitCount = 0;
        this.visitAlarmCount = 0;
        this.avgVisitAlarmCount = 0;
        this.healthRatio = 0f;
        this.avgHealthRatio = 0f;
        this.avgHandleLen = 0f;
        this.avgAvgRespTime = 0L;
    }

    /**
     * 系统ID
     */
    private Integer systemId;
    /**
     * 系统名称
     */
    private String systemName;
    /**
     * 归属区域Code
     */
    private String areaCode;
    /**
     * 归属区域
     */
    private String areaName;
    /**
     * 访问量
     */
    private Integer visitCount;
    /**
     * 平均访问量 ，访问量状态  visit_count - avg_visit_count
     */
    private Integer avgVisitCount;

    /**
     * 平均交易时长 ,平均响应时长状态(较过去7天，升降幅度) avg_handle_len-avg_avg_resp_time
     */
    private Long avgAvgRespTime;
    /**
     * 失败访问量
     * 失败访问量状态 fail_visit_count-avg_fail_visit_count
     */
    private Integer failVisitCount;
    /**
     * 平均失败访问量
     */
    private Integer avgFailVisitCount;
    /**
     * 告警访问量
     * 告警访问量状态(较过去7天，升降幅度)  visit_alarm_coun-avg_visit_alarm_count
     */
    private Integer visitAlarmCount;

    /**
     * 平均响应时长  ,平均响应时长状态(较过去7天，升降幅度) avg_handle_len-avg_avg_deal_time
     */
    private Float avgHandleLen;
    /**
     * 平均告警访问量
     */
    private Integer avgVisitAlarmCount;
    /**
     * 健康度
     */
    private Float healthRatio;
    /**
     * 平均健康度，健康度状态(较过去7天，升降幅度)  health_ratio-avg_health_ratio
     */
    private Float avgHealthRatio;

    /**
     * 累加
     * @param vo 参数对象
     * @return VisitDistribteDetailVO
     */
    public VisitDistribteDetailVO sum(VisitDistribteDetailVO vo) {
        if (this.systemId == null) {
            this.systemId = vo.getSystemId();
        }
        if (vo.getAreaCode()!=null){
            this.areaCode =  vo.getAreaCode();
        }
        if (vo.getSystemName()!=null){
            this.systemName = vo.getSystemName();
        }
        this.areaName = vo.getAreaName();
        this.visitCount += vo.getVisitCount();
        this.avgVisitCount += vo.getAvgVisitCount();
        this.failVisitCount += vo.getFailVisitCount();
        this.avgFailVisitCount += vo.getAvgFailVisitCount();
        this.visitAlarmCount += vo.getVisitAlarmCount();
        this.avgVisitAlarmCount += vo.getAvgVisitAlarmCount();
        this.healthRatio += vo.getHealthRatio();
        this.avgHealthRatio += vo.getAvgHealthRatio();
        this.avgHandleLen += vo.getAvgHandleLen();
        this.avgAvgRespTime += vo.getAvgAvgRespTime();
        return this;
    }

}
